<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="s" uri="/struts-tags"%>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="../estilos/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="../estilos/jquery-ui.css" type="text/css"
	media="all" />

<script type="text/javascript">
	function deleteCli(codCliente) {
		if (confirm("¿Desea eliminar el cliente seleccionado?")) {
			document.deleteForm.typeModif.value = 'delete';
			document.deleteForm.codCliente.value = codCliente;
			document.deleteForm.submit();
		}
	}
	function search() {
		if (document.busquedaForm.razonSocialAbuscar.value != ''
				|| document.busquedaForm.cuitAbuscar.value != ''
				|| document.busquedaForm.responsableAbuscar.value != '') {
			document.busquedaForm.typeModif.value = 'filter';
			document.busquedaForm.returnAction.value = 'delete';
			document.busquedaForm.action = "filtrarClientesAction";
			document.busquedaForm.submit();
		}
	}

	function verificarBusquedaCliente() {
		if (document.busquedaForm.clienteNoEncontrado.value == 'true') {
			alert("No se ha encontrado un cliente con esos datos de búsqueda. Por favor intente nuevamente.");
		}
	}
</script>
<title>LABTEC - Eliminar Cliente</title>
</head>
<body onload="verificarBusquedaCliente()">
	<div id="header">
		    <jsp:include page="../jsp/menuIniciador.jsp" />
	</div>
	<div class="sheet" id="body">
		<div class="sheet-tl"></div>
		<div class="sheet-tr"></div>
		<div class="sheet-bl"></div>
		<div class="sheet-br"></div>
		<div class="sheet-tc"></div>
		<div class="sheet-bc"></div>
		<div class="sheet-cl"></div>
		<div class="sheet-cr"></div>
		<div class="sheet-cc"></div>
		<div class="sheet-body">
			<h5 class="postcontent">Eliminar Cliente</h5>
			<br />
			<s:form action="gestionClienteAction" theme="simple" id="busquedaForm">
				<s:hidden name="typeModif" />
				<s:hidden name="returnAction" />
				<s:hidden name="clienteNoEncontrado" />
				<table width="100%">
					<tr>
						<td width="15%">Razón Social</td>
						<td width="20%"><input type="text" name="razonSocialAbuscar"
							id="razonSocialAbuscar" /></td>
						<td width="15%">CUIT</td>
						<td width="20%"><input type="text" name="cuitAbuscar"
							id="cuitAbuscar" /></td>
						<td width="15%">Responsable</td>
						<td width="15%"><input type="text" name="responsableAbuscar"
							id="responsableAbuscar" /></td>
						<td width="35%" align="left"><input type="button"
							name="buscar" value="Buscar" onclick="search()" /></td>
					</tr>
				</table>
			</s:form>
			<br />
			<div style="height: 250px; width: 1135px; overflow: scroll;"
				align="center">
				<table class="article">
					<thead>
						<tr>
							<th>Razón Social</th>
							<th>Responsable</th>
							<th>CUIT</th>
							<th>Domicilio</th>
							<th>Localidad</th>
							<th>Código Postal</th>
							<th>Provincia</th>
							<th>Teléfono</th>
							<th>Fax</th>
							<th>Email</th>
							<th>Eliminar</th>
						</tr>
					</thead>
					<tbody>
						<s:iterator value="listClientes">
							<tr>
								<s:hidden value="codCliente"></s:hidden>
								<td width="15%"><s:property value="razonSocial" /></td>
								<td width="10%"><s:property value="responsable" /></td>
								<td width="9%"><s:property value="cuit" /></td>
								<td width="15%"><s:property value="domicilio" /></td>
								<td width="10%"><s:property value="localidad" /></td>
								<td width="5%"><s:property value="codigoPostal" /></td>
								<td width="10%"><s:property value="provincia" /></td>
								<td width="8%"><s:property value="telefono" /></td>
								<td width="10%"><s:property value="email" /></td>
								<td width="8%"><s:property value="fax" /></td>
								<td><input type="button" value="Eliminar"
									onclick="deleteCli('<s:property value="codCliente"/>')">
								</td>
							</tr>
						</s:iterator>
					</tbody>
				</table>
			</div>
			<s:form action="gestionClienteAction" id="deleteForm" validate="false">
				<s:hidden name="typeModif"></s:hidden>
				<s:hidden name="codCliente"></s:hidden>
			</s:form>
		</div>
	</div>

</body>
</html>